
#define ascii_zero 48;
#include "arduino.h"
unsigned int p;
unsigned int  LED_ARRAY[8]; //uint8_t
unsigned int PIN;

char status_buf[100];
char temp;
void relay_status_change(char ROOM_NO, unsigned int ON_OFF){
	unsigned int index =0; // to update the LED_ARRAY
	
	
switch (ROOM_NO)
  {
  case 'A': PIN = 13; index=0; break;
  case 'B': PIN = 12; index=1; break;
  case 'C': PIN = 8; index=2; break;
  case 'D': PIN = 7; index=3;break;
  case 'E': PIN = 4;  index=4; break;
  case 'F': PIN = 3; index=5;break;
  case 'G': PIN = 2; index=6; break;
  case 'H': PIN = 5; index=7;break;
	//default: PIN = 1; break;
		
		default:  break;
		
		
  }
	if(ON_OFF != 'N')
	{	
	LED_ARRAY[index] = ON_OFF;
	ON_OFF = ON_OFF -ascii_zero;
	digitalWrite(PIN, ON_OFF);
	
	}
	
		

}


void relay_array_init()
	{
		unsigned int i =0; 
	  for (i = 0; i<8 ;i++){
		LED_ARRAY[i] = ascii_zero;
		switch(i){
		case 0: PIN = 13; break;
		case 1: PIN = 12; break;
		case 2: PIN = 8; break;
		case 3: PIN = 7; break;
		case 4: PIN = 4; break;
		case 5: PIN = 3; break;
		case 6: PIN = 2; break;
		case 7: PIN = 5; break;
		
		
		
		}
		
		digitalWrite(PIN, 0);
		
	
	}

}



char led_array_pin(unsigned int idx){

		temp =LED_ARRAY[idx];

return temp;

}


void print_relay_status (){
	p =0;
		Serial.println("Lights status ");
while(p<8){
temp = led_array_pin(p);
	Serial.println(&temp);
	p++;
}
	


}

